# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-tomlib
_gemname=tomlib
pkgver=0.6.0
pkgrel=1
pkgdesc="Fast and standards-compliant TOML parser and generator for Ruby"
url="https://github.com/kgiszczak/tomlib"
arch="all"
license="MIT"
checkdepends="ruby-rspec"
makedepends="ruby-dev"
source="https://github.com/kgiszczak/tomlib/archive/v$pkgver/ruby-tomlib-$pkgver.tar.gz
	fix-requires.patch
	no-simplecov.patch
	"
builddir="$srcdir/tomlib-$pkgver"

build() {
	gem build $_gemname.gemspec
	gem install \
		--local \
		--install-dir dist \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname
}

check() {
	GEM_PATH='dist' rspec
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"
	cd "$builddir"/dist

	mkdir -p "$gemdir"
	cp -r extensions gems specifications "$gemdir"/

	# Remove unnecessary files...
	find "$gemdir"/extensions/ -name mkmf.log -delete
	cd "$gemdir"/gems/$_gemname-$pkgver
	rm -r ext/ lib/tomlib/*.so
}

sha512sums="
f070cf828ec6412211595181c35a047c44206f01343d266586f2ad2bc1b4b4ec41b3fbf5383ecd35cb57732e4229c0cb6bf0c7e8ee2a382ef535d37e0dc54e73  ruby-tomlib-0.6.0.tar.gz
cb9145111d7de37e74c528583be7818359d94793fa6f19907c9c9a123b85b10b75a963f3dfc3db97e7ebf8051097d43fb276ccfca05f3bed327ed4bd2e28ccd0  fix-requires.patch
5f3a9c3531d7f9cfa5ffe06701e3c732082951ffabbab6a8dc4181172bcffdbfc97fdb3218d2a98c828855fe19f3db2088c6786f98fb9ec16cfd397a727e5596  no-simplecov.patch
"
